#ifndef SM_MESSAGE_H
#define SM_MESSAGE_H

namespace base {
namespace SM {

#include <string>
#include <list>
#include <any>

#include <stdint.h>
#include <assert.h>


class SmMessage {
public:
    SmMessage();
    ~SmMessage();

    int32_t GetMsgName() const
    {
        return msgName_;
    }
    void SetMsgName(int32_t name)
    {
        msgName_ = name;
    }
    int32_t GetMsgPara1() const
    {
        return msgPara1_;
    }
    void SetMsgPara1(int32_t para)
    {
        msgPara1_ = para;
    }
    int32_t GetMsgPara2() const
    {
        return msgPara1_;
    }
    void SetMsgPara2(int32_t para)
    {
        msgPara2_ = para;
    }
    int32_t GetHanleTime() const
    {
        return msgHandleTime_;
    }

    int32_t getIntData() const
    {
        int32_t num;
        SmErrorCode ret = msgData_.PopNumberDate(num);
        assert(ret != SmErrorCode::SM_GET_NUMBER_DATA_FAILED);
        return num;
    }

    std::string getStringData() const
    {
        std::string str;
        SmErrorCode ret = msgData_.PopStringData(str);
        assert(ret != SmErrorCode::SM_GET_STRING_DATA_FAILED);
        return str;
    }

private:
    struct Message {
        void PushNumberData(int32_t data);
        SmErrorCode PopNumberDate(int32_t &data);
        void PushStringData(const std::string data);
        SmErrorCode PopStringData(std::string &data);
        void clearData();

        std::list<int32_t> numberData_;
        std::list<std::string> stringData_;
    };
private:
    int32_t msgName_;
    int32_t msgPara1_;
    int32_t msgPara2_;
    std::any msgObj_;
    Message msgData_;
    SmMessage *msgNext_;
    int32_t msgHandleTime_;
};

} // namespace SM

} // namespace base

#endif //SM_MESSAGE_H